#!/bin/bash
install_ros_package()
{
	sudo apt-get install ros-hydro-$1
}
ros_service_list_params()
{
	rosservice type $1 | rossrv show
}

#ROS/UBUNTU ALIASES
alias s='roscore'
alias dl='sudo apt-get install '
alias dl_hydro=install_ros_package
alias rp='echo $ROS_PACKAGE_PATH'
alias update='sudo apt-get update'
alias root='sudo su'
alias nodes='rosnode list'
alias topics='rostopic list'
alias svcs='rosservice list'
alias services='rosrun rqt_service_caller rqt_service_caller &'
alias bag='rqt_bag &'
alias sparams=ros_service_list_params
alias params='rosparam get /' 	 	 	
alias rec='rosbag record -a'
alias sshbb='sshpass -p bb ssh bbauvsbc1@bbauv'
alias catm='catkin_make'
alias sim=runSim
alias vision=runVisionUI


#MINI Functions 
check_process() {
  echo "checking $1"
  [ "$1" = "" ]  && return 0
  [ `pgrep $1` ] && return 1 || return 0
}
runSim() {
	check_process "roscore"
	[ $? -eq 0 ] && echo "roscore not running" &&  roscd Simulation && (roscore &) 
	[ $? -eq 1 ] && echo "roscore running..." && roscd Simulation 
	rosrun uwsim uwsim --configfile ./scenes/sauv_scene.xml
}

runVisionUI(){
	check_process "roscore"
	[ $? -eq 0 ] && echo "roscore not running" && (roscore &) 
	[ $? -eq 1 ] && echo "roscore running..."
	rosrun GUI GUI_node
}

#MINI SCRIPTS/CONFIG

#SETS 'terminator' as Default Terminal
alias set_terminator_as_default='gconftool --type string --set /desktop/gnome/applications/terminal/exec terminator'